/**
 * create by young (young2f@outlook.com) on 2020/12/3
 */
'use strict';
const model = require('../base/modelBase');
const _ = require('lodash');
module.exports = app => {
  const mongoose = app.mongoose;
  const schema = mongoose.Schema;
  // schema.plugin(require('mongoose-timestamp'));
  // schema.set('timestamps', true);
  const connect = app.mongooseDB.get('aiotBusiness');
  const json = {
    code: { type: String, desc: '物模型编码' },
    name: { type: String, desc: '物模型名称' },
    deviceType: { type: String, desc: '设备类型' },
    points: { type: Array, desc: '点位' },
  };
  const _model = _.cloneDeep(model);
  _.assign(_model, json);
  const _schema = new schema(
    _model
  );
  return connect.model('ThingModel', _schema);
};
